import 'package:flutter/material.dart';
import 'package:setting_test01/arc_clipper.dart';



class LoginBackground extends StatelessWidget {
  final showIcon;
  final image;

  LoginBackground({this.showIcon = true, this.image});

  Widget buildTopHalf(BuildContext context){
    var deviceSize = MediaQuery.of(context).size;
    return Flexible(
      flex: 2,
      child: ClipPath(
        clipper: ArcClipper(),
        child: Stack(
          children: <Widget>[
            Container(
              decoration: BoxDecoration(
                gradient: LinearGradient(colors:<Color>[Colors.cyan.shade600,Colors.blue.shade900]),
              ),
            ),
            showIcon ?
                Center(
                  child: SizedBox(
                    height:deviceSize.height / 8,
                    width:deviceSize.width / 2,
                    child: FlutterLogo(textColor: Colors.yellow),
                  ),
                ):
                Container(
                  width: double.infinity,
                  child: image != null  ? Image.network(image,fit:BoxFit.cover,): Container(),
                ),
          ],
        ),
      ),
    );
  }

  Widget buildBottomHalf(){
    return Flexible(
      flex: 3,
      child: Container(),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        buildTopHalf(context),
        buildBottomHalf(),
      ],
    );
  }
}

